﻿using DataWorks_Sqlite.MappingClass;
using DataWorks_Tools.BasicMethods;
using DataWorks_Tools.LSTMDetails;
using DataWorks_Tools.MappModals;
using DataWorks_Tools.MatlabDetails;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DataWorks_Tools.ProcessExcute.LSTM
{
    public static class LSTMProcess
    {
        public static async Task<List<string>> LSTMPredictProcessExcute(dw_props_admin dw_Props_Admin, dw_props_datapredict_lstm dw_Props_Datapredict_Lstm)
        {
            var selectdatefilearray = dw_Props_Datapredict_Lstm.selecteddirectory.ReComma().Split(',');
            var originaldatapath = dw_Props_Datapredict_Lstm.originaldatapath.YXHPathReplace();
            var savedatapath = dw_Props_Datapredict_Lstm.savedatapath.YXHPathReplace();
            var onnxfilepath = dw_Props_Datapredict_Lstm.onnxfilepath.YXHPathReplace();
            var scalerpath = dw_Props_Datapredict_Lstm.scalerpath.YXHPathReplace();
            var ismultithreads = dw_Props_Admin.ismultithreads;
            DataLSTMPredictModal dataPredictModal = new DataLSTMPredictModal();
            dataPredictModal.odpath = originaldatapath;
            dataPredictModal.rdpath = savedatapath;
            dataPredictModal.onnxfilepath = onnxfilepath;
            dataPredictModal.datedir = selectdatefilearray;
            dataPredictModal.scalerpath = scalerpath;
            if (originaldatapath != null && savedatapath != null && selectdatefilearray != null && onnxfilepath != null && scalerpath != null)
            {
                if (ismultithreads == 1)
                {
                    var t = await LSTMPredictProcess.YXHExcuteLSTMPredictMultiGroupXScalerAutoGPUAsync(dataPredictModal);
                    return t;
                }
                else
                {
                    var t = await LSTMPredictProcess.YXHExcuteLSTMPredictMultiGroupXScalerAutoAsync(dataPredictModal);
                    return t;
                }
            }
            else
            {
                return new List<string>() { "参数错误" };
            }

        }
    }
}
